import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

import com.damon.thread.PrintSocketThread;

public class CharTest2 {
	public static void main(String[] args) {
		
		try {
			String path = "src/main/resources/条码";
			InputStream is = new FileInputStream(path);
			byte[] bytes = new byte[5000];
			is.read(bytes);
			String msg = new String(bytes);
			System.out.println(msg);
			is.close();
			
			Socket socket = new Socket("10.66.252.202",9100);
			OutputStream os = socket.getOutputStream();
			InputStream iss = socket.getInputStream();
			
			int count = 1;
			while(count<2) {
//				System.out.println(777);
				os.write(msg.getBytes("utf-8"));
				os.flush();
				count++;
			}
//			Thread.sleep(1000);
//			byte[] isbytes = new byte[2000];
//			iss.read(isbytes);
//			System.out.println(new String(isbytes));
			os.close();
			socket.close();
			System.exit(0);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
